# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
# TODO: Build it from source instead of downloading prebuilt JAR (although
#   it does not contain any native binaries), so we can patch it when needed.
pkgname=closure-compiler
pkgver=20171203
pkgrel=1
pkgdesc="A JavaScript checker and optimizer"
url="https://developers.google.com/closure/compiler/"
arch="noarch !s390x !riscv64" # java
license="Apache-2.0"
depends="java-jre-headless"
source="$pkgname-$pkgver-jar.tar.gz::https://dl.google.com/$pkgname/compiler-$pkgver.tar.gz
	$pkgname"
builddir="$srcdir/$pkgname-$pkgver"

check() {
	java -jar "$srcdir"/$pkgname-v$pkgver.jar --version
}

package() {
	cd "$srcdir"

	install -D -m 644 $pkgname-v$pkgver.jar \
		"$pkgdir"/usr/share/java/$pkgname-$pkgver.jar
	ln -s $pkgname-$pkgver.jar "$pkgdir"/usr/share/java/$pkgname.jar

	install -D -m 755 $pkgname "$pkgdir"/usr/bin/$pkgname
}

sha512sums="478e8f1b665e4ac74f5307aa9fdc8042d743e8e455144894a1dde8596f29befff08e34343718a663fa0ae82007d72908b015af388bfac19cdfaa95985737614b  closure-compiler-20171203-jar.tar.gz
18127beb77da790d1fa13fddc4056c485ca2b4a263becd7d37542dc705d08c342f842aa22322dd9aaa8e0ad651f45fc4c0ff632201cc5f20d391843d2c1b2661  closure-compiler"
